home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / toolkit / vbof_v11 / vbofdbgr.cls < prev    next >
Text File  |  1996-03-03  |  19KB  |  661 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "VBOFDBGridWrapper"
  6. Attribute VB_Creatable = True
  7. Attribute VB_Exposed = True
  8. Option Explicit
  9.  
  10. ' (c) Copyright 1995 Ken Fitzpatrick
  11. '     All Rights Reserved
  12. '     Cannot be distributed or sold without permission
  13. '
  14. ' VBOFDBGridWrapper is a supplemental GUI Control
  15. '   Wrapper for Microsoft Visual Basic 4.0.
  16. '   It is valid only in conjunction with the
  17. '   following Classes Modules:
  18. '       VBOFCollection
  19. '       VBOFObjectLink
  20. '       VBOFObjectManager
  21.  
  22. ' VBOFDBGridWrapper is a wrapper class for
  23. '   providing automatic interfacing between a
  24. '   DBGrid VB control and an underlying
  25. '   VBOFCollection
  26.  
  27. Private pvtVBOFObjectManager As VBOFObjectManager
  28. Private pvtCollection As VBOFCollection
  29. Private pvtSample As Variant
  30. Private pvtParent As Variant
  31. Private pvtDBGrid As Variant
  32. Private pvtSupportedTypeNames As String
  33.  
  34. Public ObjectID As Long
  35.  
  36. Public Function Sort( _
  37.     Optional SortField As Variant, _
  38.     Optional SortOrder As Variant) As Boolean
  39. ' Sorts the objects in the underlying
  40. '   VBOFCollection according to the field
  41. '   referenced in SortField:= and the sort
  42. '   order referenced in SortOrder:=
  43. ' For additional information, see the VBOF User's
  44. '   Guide
  45. ' Programming example:
  46. '   MyWrapper.Sort _
  47. '       SortField:="FirstName", _
  48. '       SortOrder:="ASC"
  49.         
  50.     Sort = _
  51.         ObjectManager.pvtWrapperSort( _
  52.             Wrapper:=Me, _
  53.             SortField:=SortField, _
  54.             SortOrder:=SortOrder)
  55. End Function
  56.  
  57.  
  58.  
  59. Public Property Get Collection() As Variant
  60. Attribute Collection.VB_Description = "Sets the underlying VBOFCollection"
  61. ' Returns my VBOFCollection object
  62.  
  63.     Set Collection = pvtCollection
  64. End Property
  65.  
  66. Private Function pvtIsFullyInitialized(Optional Collection As Variant, Optional DBGrid As Variant, Optional Verbose As Variant) As Boolean
  67.     
  68.     If Not pvtVerifyCollection( _
  69.         Collection:=Collection, _
  70.         Verbose:=Verbose) _
  71.     Then
  72.         pvtIsFullyInitialized = False
  73.         Exit Function
  74.     End If
  75.     
  76.     If Not pvtVerifyDBGrid( _
  77.         DBGrid:=DBGrid, _
  78.         Verbose:=Verbose) _
  79.     Then
  80.         pvtIsFullyInitialized = False
  81.         Exit Function
  82.     End If
  83.  
  84.     pvtIsFullyInitialized = True
  85. End Function
  86.  
  87. Private Function pvtSetParent(Optional Parent As Variant, Optional MethodName As Variant) As Boolean
  88.     
  89.     On Local Error Resume Next
  90.     
  91.     pvtSetParent = True
  92.     
  93.     If IsMissing(Parent) Then
  94.         If pvtParent Is Nothing Then
  95.             pvtErrorMessage TypeName(Me) & " cannot process the '." & MethodName & "' method for this object because the 'Parent:=' parameter is missing and no preceeding method has established a default object."
  96.             pvtSetParent = False
  97.         End If
  98.     Else
  99.         Set pvtParent = Parent
  100.     End If
  101.  
  102. End Function
  103.  
  104. Private Function pvtSetSample(Optional Sample As Variant, Optional MethodName As Variant) As Boolean
  105.     
  106.     On Local Error Resume Next
  107.     
  108.     pvtSetSample = True
  109.     
  110.     If IsMissing(Sample) Then
  111.         If pvtSample Is Nothing Then
  112.             pvtErrorMessage TypeName(Me) & " cannot process the '." & MethodName & "' method for this object because the 'Sample' parameter is missing and no preceeding method has established a default."
  113.             pvtSetSample = False
  114.         End If
  115.     End If
  116.  
  117. End Function
  118.  
  119.  
  120. Public Property Let Bookmark(Bookmark As Variant)
  121. Attribute Bookmark.VB_Description = "Sets the Bookmark property of the DBGrid"
  122. ' Sets the Bookmark value of the DBGrid
  123. ' Using this method:
  124. '       MyDBGridWrapper.Bookmark = _
  125. '           MyBookMark
  126.     
  127.     On Local Error Resume Next
  128.  
  129. ' bullet-proofing
  130.     If Not pvtIsFullyInitialized() _
  131.     Then
  132.         Exit Property
  133.     End If
  134.  
  135.     pvtCollection. _
  136.         pvtDBGridBookmark _
  137.             (DBGrid:=pvtDBGrid) = _
  138.                 Bookmark
  139.  
  140. End Property
  141.  
  142.  
  143. Public Property Get Bookmark() As Variant
  144. ' Returns the Bookmark value of the DBGrid
  145. ' Using this method:
  146. '     Set MyBookmark = _
  147. '         MyDBGridWrapper.Bookmark
  148.     
  149.     On Local Error Resume Next
  150.  
  151. ' bullet-proofing
  152.     If Not pvtIsFullyInitialized() _
  153.     Then
  154.         Exit Property
  155.     End If
  156.  
  157.     Bookmark = _
  158.         pvtCollection. _
  159.             pvtDBGridBookmark _
  160.                 (DBGrid:=pvtDBGrid)
  161.  
  162. End Property
  163.  
  164.  
  165. Public Property Set BookmarkObject(Object As Variant)
  166. Attribute BookmarkObject.VB_Description = "Set the Bookmark property of the DBGrid to equate to the specified object"
  167. ' Sets the Bookmark of the DBGrid to the position
  168. '   of Object
  169. ' Using this method:
  170. '     Set MyDBGridWrapper.BookmarkObject = _
  171. '         MyObject
  172.     
  173.     On Local Error Resume Next
  174.  
  175. ' bullet-proofing
  176.     If Not pvtIsFullyInitialized() _
  177.     Then
  178.         Exit Property
  179.     End If
  180.  
  181.     Set pvtCollection. _
  182.         pvtDBGridBookmarkObject _
  183.             (DBGrid:=pvtDBGrid) = _
  184.                 Object
  185. End Property
  186.  
  187.  
  188. Public Property Get BookmarkObject() As Variant
  189. ' Returns the Object at the Bookmark value of the
  190. '   DBGrid
  191. ' Using this method:
  192. '       MyObject = _
  193. '           MyDBGridWrapper. BookmarkObject
  194.     
  195.     On Local Error Resume Next
  196.  
  197. ' bullet-proofing
  198.     If Not pvtIsFullyInitialized() _
  199.     Then
  200.         Exit Property
  201.     End If
  202.  
  203.     Set BookmarkObject = _
  204.         pvtCollection. _
  205.             pvtDBGridBookmarkObject _
  206.                 (DBGrid:=pvtDBGrid)
  207.  
  208. End Property
  209.  
  210.  
  211. Public Property Set DBGrid(DBGrid As Variant)
  212. Attribute DBGrid.VB_Description = "Sets the underlying DBGrid"
  213.     pvtVerifyDBGrid _
  214.         DBGrid:=DBGrid
  215. End Property
  216.  
  217. Public Property Set Collection(Collection As Variant)
  218.     
  219.     If Collection Is Nothing Then
  220.         Set pvtCollection = Nothing
  221.         Exit Property
  222.     End If
  223.     
  224.     pvtVerifyCollection _
  225.         Collection:=Collection, _
  226.         Verbose:=True
  227. End Property
  228.  
  229. Public Property Get ObjectManager() As VBOFObjectManager
  230. ' Return my reference to the VBOFObjectManager
  231.     
  232.     Set ObjectManager = pvtVBOFObjectManager
  233. End Property
  234.  
  235. Public Property Set ObjectManager(anObjectManager As VBOFObjectManager)
  236. ' Set my reference to the VBOFObjectManager
  237.     
  238.     Set pvtVBOFObjectManager = anObjectManager
  239. End Property
  240.  
  241. Private Function pvtErrorMessage(Optional ErrorMessage As Variant) As Long
  242.     pvtErrorMessage = _
  243.         pvtVBOFObjectManager.DisplayErrorMessage _
  244.             (ErrorMessage)
  245. End Function
  246.  
  247. Private Function pvtUseCollection(Optional CollectionParm As Variant, Optional Verbose As Variant) As Variant
  248.     Set pvtUseCollection = _
  249.         ObjectManager. _
  250.             pvtWrapperUseCollection( _
  251.                 CollectionParm:=CollectionParm, _
  252.                 pvtCollection:=pvtCollection, _
  253.                 Verbose:=Verbose, _
  254.                 WrapperName:="DBGrid")
  255. End Function
  256.  
  257. Private Function pvtUseDBGrid(Optional DBGridParm As Variant, Optional Verbose As Variant) As Variant
  258.     Set pvtUseDBGrid = _
  259.         ObjectManager. _
  260.             pvtWrapperUseControl( _
  261.                 ControlParm:=DBGridParm, _
  262.                 pvtControl:=pvtDBGrid, _
  263.                 SupportedNames:=pvtSupportedTypeNames, _
  264.                 Verbose:=Verbose, _
  265.                 WrapperName:="DBGrid")
  266. End Function
  267.  
  268.  
  269. Private Function pvtVerifyCollection(Optional Collection As Variant, Optional Verbose As Variant) As Boolean
  270.     pvtVerifyCollection = _
  271.         ObjectManager. _
  272.             pvtWrapperVerifyCollection( _
  273.                 Collection:=Collection, _
  274.                 pvtCollection:=pvtCollection, _
  275.                 Verbose:=Verbose, _
  276.                 WrapperName:="DBGrid")
  277. End Function
  278.  
  279. Public Function Rebind( _
  280.     Optional Collection As Variant, _
  281.     Optional DBGrid As Variant) As Boolean
  282. ' Rebinds the Wrapper to a Collection or DBGrid
  283. '   after having changed the assignment of either.
  284. '   For example, in the following scenario, the
  285. '   VBOFSDBGridWrapper must be rebound because the
  286. '   VBOFCollection has been significantly altered:
  287. '
  288. '   Dim pvtAddresses as VBOFCollection
  289. '   Dim pvtPerson as Person
  290. '   Dim MyDBGridWrapper as VBOFDBGridWrapper
  291. '   Set MyDBGridWrapper = _
  292. '       ObjectManager.NewVBOFDBGridWrapper ( _
  293. '           Collection:=pvtAddresses, _
  294. '           DBGrid:=MyDBGrid)
  295. '
  296. ' the following line alters the state of the data
  297. ' in-effect at the time of the above binding
  298. '   Set pvtAddresses = pvtPerson.Addresses
  299. ' rebind the Wrapper
  300. '   MyDBGridWrapper.Rebind _
  301. '           Collection:=pvtAddresses
  302.     
  303. ' bullet-proofing
  304.     If Not IsMissing(Collection) Then
  305.         If TypeName(Collection) <> _
  306.             "VBOFCollection" _
  307.         Then
  308.             pvtErrorMessage TypeName(Me) & " cannot process the '.Rebind' method because the 'Collection:=' parameter is not a VBOFCollection."
  309.             Rebind = False
  310.             Exit Function
  311.         End If
  312.     End If
  313.     If Not IsMissing(DBGrid) Then
  314.         If TypeName(DBGrid) <> "DBGrid" Then
  315.             pvtErrorMessage TypeName(Me) & " cannot process the '.Rebind' method because the 'DBGrid:=' parameter is not a Visual Basic DBGrid control.  Please use a VBOF Wrapper for the " & TypeName(DBGrid) & " control (or request the development of one.)"
  316.             Rebind = False
  317.             Exit Function
  318.         End If
  319.     End If
  320.     If Not pvtIsFullyInitialized( _
  321.         Collection:=Collection, _
  322.         DBGrid:=DBGrid, _
  323.         Verbose:=False) _
  324.     Then
  325.         Exit Function
  326.     End If
  327.     
  328.     pvtDBGrid.Refresh
  329.  
  330.     Rebind = True
  331. End Function
  332.  
  333. Public Function Refresh( _
  334.     Optional DisplayOnly As Variant) As Boolean
  335. ' Refreshes the display of the DBGrid
  336. ' Using this method:
  337. '   MyDBGridWrapper.Refresh
  338.     
  339.     On Local Error Resume Next
  340.  
  341. ' bullet-proofing
  342.     If Not pvtIsFullyInitialized() _
  343.     Then
  344.         Exit Function
  345.     End If
  346.     
  347.     If Not IsMissing(DisplayOnly) Then
  348.         If DisplayOnly Then
  349.         Else
  350.             Set Collection = _
  351.                 pvtCollection.Refresh
  352.         End If
  353.     Else
  354.     End If
  355.  
  356.     pvtDBGrid.Refresh
  357.  
  358.     Refresh = True
  359. End Function
  360.  
  361.  
  362. Private Function pvtVerifyDBGrid(Optional DBGrid As Variant, Optional Verbose As Variant) As Boolean
  363.     pvtVerifyDBGrid = _
  364.         ObjectManager. _
  365.             pvtWrapperVerifyControl( _
  366.                 Control:=DBGrid, _
  367.                 pvtControl:=pvtDBGrid, _
  368.                 Verbose:=Verbose)
  369. End Function
  370.  
  371. Public Property Get DBGrid() As Variant
  372.     Set DBGrid = pvtDBGrid
  373. End Property
  374.  
  375.  
  376. Public Function SetNumberOfRows() As Boolean
  377. ' Informs the DBGrid of the number of rows that
  378. '   are to be added
  379. ' Note:  the referenced objects must contain the
  380. '   method 'ObjectDBGridValue', which must populate
  381. '   and return the RowBuffer object
  382. '   (for more information, find "RowBuffer" in the
  383. '   online VB Help.)
  384. '
  385. ' Note:  this method is optional and can be coded as
  386. '   follows:
  387. '   Private Sub Form_Load()
  388. '       MyDBGridWrapper.SetNumberOfRows
  389. '   End Sub
  390.  
  391.     On Local Error Resume Next
  392.     
  393.     If Not pvtIsFullyInitialized() _
  394.     Then
  395.         Exit Function
  396.     End If
  397.  
  398.     SetNumberOfRows = _
  399.         pvtCollection. _
  400.             pvtDBGridSetNumberOfRows _
  401.                 (DBGrid:=pvtDBGrid)
  402. End Function
  403.  
  404.  
  405. Public Function Unbind() As Boolean
  406.  
  407.     Set pvtCollection = Nothing
  408.     Set pvtDBGrid = Nothing
  409.     Set pvtVBOFObjectManager = Nothing
  410.  
  411. End Function
  412.  
  413. Public Function UnboundAddData( _
  414.     Optional DBGrid As Variant, _
  415.     Optional RowBuf As Variant, _
  416.     Optional NewRowBookmark As Variant, _
  417.     Optional Sample As Variant, _
  418.     Optional Parent As Variant) As Variant
  419. ' Processes the UnboundAddData event of the DBGrid.
  420. '   Automatically instantiates a new object,
  421. '   populates it, adds it to the VBOFCollection
  422. '   and returns the VBOFCollection to the
  423. '   application.
  424. '
  425. ' Parameters:
  426. '   RowBuf:= is the same RowBuf parameter found
  427. '       in the application's UnboundAddData event
  428. '       handler
  429. '   NewRowBookmark:= is the same NewRowBookmark
  430. '       parameter found in the application's
  431. '       UnboundAddData event handler
  432. '   Sample:= (Optional) identifies the class
  433. '       type to instantiate with the new data.
  434. '       If a previous VBOFDBGridWrapper method had
  435. '       already established a Sample:=, this
  436. '       parameter can be eliminated
  437. '   Parent:= (Optional) identifies the object
  438. '       which is the parent ("container") object of
  439. '       the objects in this collection.
  440. '       If a previous VBOFDBGridWrapper method had
  441. '       already established a Parent:=, this
  442. '       parameter can be eliminated
  443. '
  444. ' Note:  this method should be coded as follows:
  445. '   Private Sub DBGrid1_UnboundAddData(ByVal RowBuf As RowBuffer, NewRowBookmark As Variant)
  446. '       Dim tempSample as New MyClass
  447. '       MyDBGridWrapper.UnboundAddData _
  448. '           RowBuf:=RowBuf, _
  449. '           NewRowBookmark:=NewRowBookmark, _
  450. '           Sample:=tempSample
  451. '   End Sub
  452.     
  453.     Dim tempParent As VBOFCollection
  454.     
  455.     On Local Error Resume Next
  456.     
  457. ' bullet-proofing
  458.     If Not pvtIsFullyInitialized( _
  459.         DBGrid:=DBGrid) _
  460.     Then
  461.         Exit Function
  462.     End If
  463.     If IsMissing(RowBuf) Then
  464.         pvtErrorMessage TypeName(Me) & " cannot process the '.UnboundAddData' method for this object because the 'RowBuf:=' parameter is missing."
  465.         Exit Function
  466.     End If
  467.     If IsMissing(NewRowBookmark) Then
  468.         pvtErrorMessage TypeName(Me) & " cannot process the '.UnboundAddData' method for this object because the 'NewRowBookmark:=' parameter is missing."
  469.         Exit Function
  470.     End If
  471.     If Not pvtSetSample( _
  472.             Sample:=Sample, _
  473.             MethodName:="UnboundAddData") Then
  474.         Set UnboundAddData = Nothing
  475.         GoTo UnboundAddData_Exit
  476.     End If
  477.  
  478. ' pick a value for Parent
  479.     Set tempParent = pvtCollection.Parent
  480.     If Not IsMissing(Parent) Then
  481.         Set tempParent = Parent
  482.     End If
  483.  
  484.     Set UnboundAddData = _
  485.         pvtCollection. _
  486.             pvtDBGridUnboundAddData( _
  487.                 DBGrid:=pvtDBGrid, _
  488.                 RowBuf:=RowBuf, _
  489.                 NewRowBookmark:=NewRowBookmark, _
  490.                 Sample:=Sample, _
  491.                 Parent:=tempParent)
  492.  
  493.     Refresh
  494.     
  495. UnboundAddData_Exit:
  496.     Exit Function
  497. End Function
  498.  
  499. Public Function UnboundWriteData( _
  500.     Optional DBGrid As Variant, _
  501.     Optional RowBuf As Variant, _
  502.     Optional WriteLocation As Variant) As Variant
  503. ' Processes the UnboundWriteData event of the DBGrid.
  504. '
  505. ' Parameters:
  506. '   RowBuf:= is the same RowBuf parameter found
  507. '       in the application's UnboundWriteData event
  508. '       handler
  509. '   WriteLocation:= is the same WriteLocation
  510. '       parameter found in the application's
  511. '       UnboundWriteData event handler
  512. '
  513. ' Note:  this method should be coded as follows:
  514. '   Private Sub DBGrid1_UnboundWriteData(ByVal RowBuf As RowBuffer, WriteLocation As Variant)
  515. '       MyDBGridWrapper.UnboundWriteData _
  516. '           RowBuf:=RowBuf, _
  517. '           WriteLocation:=WriteLocation
  518. '   End Sub
  519.     
  520.     On Local Error Resume Next
  521.     
  522.     If Not pvtIsFullyInitialized( _
  523.         DBGrid:=DBGrid) _
  524.     Then
  525.         Exit Function
  526.     End If
  527.  
  528.     Set UnboundWriteData = _
  529.         pvtCollection. _
  530.             pvtDBGridUnboundWriteData( _
  531.                 DBGrid:=pvtDBGrid, _
  532.                 RowBuf:=RowBuf, _
  533.                 WriteLocation:=WriteLocation)
  534.  
  535.     Refresh
  536.     
  537. UnboundWriteData_Exit:
  538.     Exit Function
  539. End Function
  540.  
  541.  
  542.  
  543. Public Function UnboundReadData( _
  544.     Optional DBGrid As Variant, _
  545.     Optional RowBuf As Variant, _
  546.     Optional StartLocation As Variant, _
  547.     Optional ReadPriorRows As Variant) As Long
  548. ' Populates the DBGrid with one row of information
  549. '   for each object in the associated
  550. '   VBOFCollection.
  551. ' Returns the number of rows added to the DBGrid
  552. ' Note:  the referenced objects must contain the
  553. '   method 'ObjectDBGridValue', which must populate
  554. '   and return the RowBuffer object
  555. '   (for more information, find "RowBuffer" in the
  556. '   online VB Help.)
  557. '
  558. ' Note:  this method should be coded in the
  559. '   DBGrid's UnboundReadData Event Procedure,
  560. '   as follows:
  561. '
  562. '   Private Sub DBGrid1_UnboundReadData(ByVal RowBuf As RowBuffer, StartLocation As Variant, ByVal ReadPriorRows As Boolean)
  563. '       MyDBGridWrapper.UnboundReadData _
  564. '           RowBuf:=RowBuf, _
  565. '           StartLocation:=StartLocation, _
  566. '           ReadPriorRows:=ReadPriorRows
  567. '   End Sub
  568.     
  569.     On Local Error Resume Next
  570.     
  571. ' bullet-proofing
  572.     If IsMissing(RowBuf) Then
  573.         pvtErrorMessage TypeName(Me) & " cannot process the '.UnboundReadData' method for this object because the 'RowBuf:=' parameter is missing."
  574.         Exit Function
  575.     End If
  576.     If IsMissing(StartLocation) Then
  577.         pvtErrorMessage TypeName(Me) & " cannot process the '.UnboundReadData' method for this object because the 'StartLocation:=' parameter is missing."
  578.         Exit Function
  579.     End If
  580.     If IsMissing(ReadPriorRows) Then
  581.         pvtErrorMessage TypeName(Me) & " cannot process the '.UnboundReadData' method for this object because the 'ReadPriorRows:=' parameter is missing."
  582.         Exit Function
  583.     End If
  584.     If Not pvtIsFullyInitialized( _
  585.         DBGrid:=DBGrid) _
  586.     Then
  587.         Exit Function
  588.     End If
  589.  
  590.     UnboundReadData = _
  591.         pvtCollection. _
  592.             pvtDBGridUnboundReadData( _
  593.                 DBGrid:=pvtDBGrid, _
  594.                 RowBuf:=RowBuf, _
  595.                 StartLocation:=StartLocation, _
  596.                 ReadPriorRows:=ReadPriorRows)
  597.  
  598. End Function
  599.  
  600. Public Function UnboundDeleteRow( _
  601.     Optional DBGrid As Variant, _
  602.     Optional Bookmark As Variant) As Long
  603. ' Removes the Bookmarked Object from the DBGrid
  604. '   and from associated VBOFCollection.
  605. ' Returns the number of rows currently ino the
  606. '   DBGrid
  607. '
  608. ' Note:  this method should be coded in the
  609. '   DBGrid's UnboundReadData Event Procedure,
  610. '   as follows:
  611. '
  612. '   Private Sub DBGrid1_UnboundDeleteRow(ByVal Bookmark As RowBuffer)
  613. '       MyDBGridWrapper.UnboundDeleteRow _
  614. '           Bookmark:=Bookmark
  615. '   End Sub
  616.     
  617.     On Local Error Resume Next
  618.     
  619. ' bullet-proofing
  620.     If IsMissing(Bookmark) Then
  621.         pvtErrorMessage TypeName(Me) & " cannot process the '.UnboundDeleteRow' method for this object because the 'Bookmark:=' parameter is missing."
  622.         Exit Function
  623.     End If
  624.     If Not pvtIsFullyInitialized( _
  625.         DBGrid:=DBGrid) _
  626.     Then
  627.         Exit Function
  628.     End If
  629.  
  630.     UnboundDeleteRow = _
  631.         pvtCollection. _
  632.             pvtDBGridUnboundDeleteRow( _
  633.                 DBGrid:=pvtDBGrid, _
  634.                 Bookmark:=Bookmark)
  635.  
  636.     Refresh
  637.     
  638.     UnboundDeleteRow = _
  639.         pvtCollection.Count
  640. End Function
  641.  
  642.  
  643. Private Sub Class_Initialize()
  644.     pvtSupportedTypeNames = "DBGrid"
  645. End Sub
  646.  
  647.  
  648. Private Sub Class_Terminate()
  649.     If Not ObjectManager Is Nothing Then
  650.     
  651. ' unregister the wrapper from the Form
  652. '       ObjectManager.pvtUnRegisterWrapperUnderForm _
  653.             Form:=Me.Form, _
  654.             Wrapper:=Me
  655.             
  656.         ObjectManager.TerminateObject _
  657.             Object:=Me
  658.     End If
  659. End Sub
  660.  
  661.